[Flight] Exclude RSC Stream if the stream resolves in a task#34838
Merged
Conversation
sebmarkbage
commented
Oct 14, 2025
| wakeChunk(resolveListeners, handler.value, initializedChunk); | ||
| } else { | ||
| if (__DEV__) { | ||
| moveDebugInfoFromChunkToInnerValue(initializedChunk, handler.value); |
Contributor
Author
There was a problem hiding this comment.
This PR surfaced another bug.
It turns out that resolveChunkDebugInfo adds a .then() listener which forces the wakeChunk pass to be taken. If that doesn't happen, then wakeChunk isn't called.
We forgot that we need to call moveDebugInfoFromChunkToInnerValue everywhere we initialize but don't call wakeChunk. We could potentially just move this out and all it next to all these instead of inside wakeChunk.
sebmarkbage
commented
Oct 14, 2025
| return null; | ||
| } | ||
| visited.add(node); | ||
| if (node.end >= 0 && node.end <= request.timeOrigin) { |
Contributor
Author
There was a problem hiding this comment.
Another drive-by fix somewhat related. Most of the time this is covered by the PROMISE_NODE path but it really applies to all of these so we can just apply it universally.
unstubbable
approved these changes
Oct 14, 2025
Ignore any path that completed before the render started.
This is a bit more optimized because it doesn't create an intermediate unnecessary array.
…eners wakeChunk doesn't get called if we initialize a value without any listeners.
09e1648 to
8cdc1ea
Compare
This was referenced Oct 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #34836.
Normally we consider microtasks, next ticks and setImmediates not as I/O to be tracked by debug info. We also exclude things that finished loading before we started rendering. That's consider cached.
This avoids emitting the "RSC stream" debug info if the stream finished within a
setTimeout. I.e. it was likely cached and so it wouldn't add any additional suspending.Unfortunately, this will often happen if you use the
createFromReadableStreamAPI to consumeresponse.bodybecause by the time you get there you'll likely have at least received part of the body already.